package com.rms.hkpc.fragment;

import android.os.Bundle;
import android.util.Log;
import android.view.View;

import com.rms.hkpc.R;
import com.rms.hkpc.constant.AllConstants;
import com.rms.hkpc.db.bean.Event;
import com.rms.hkpc.fragment.base.BaseChildrenFragment;

import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode;

public class WorksOrderFragment extends BaseChildrenFragment {

    @Override
    protected int getLayoutId() {
        return R.layout.fragment_records;
    }

    @Override
    protected void initFragment() {
        WorksOrderConFragment worksOrderConFragment = new WorksOrderConFragment();
        Bundle bundle = new Bundle();
        bundle.putInt(AllConstants.WHAT, 1);
        FilterFragment filterFragment = new FilterFragment();
        filterFragment.setArguments(bundle);
        fragmentList.add(worksOrderConFragment);
        fragmentList.add(filterFragment);
    }

    @Override
    protected void initView() {
        showFragment(mFragment, fragmentList.get(0));
    }

    @Override
    protected void filterClick() {
        showFragment(mFragment, fragmentList.get(1));
    }

    @Override
    protected int navTitle() {
        return R.string.worksOrder;
    }

    @Subscribe(threadMode = ThreadMode.MAIN)
    public void onEvent(Event event) {
        if (event.getWhat() == 1) {
            showFragment(mFragment, fragmentList.get(0));
            ivFilter.setVisibility(View.VISIBLE);
        }
    }

    @Override
    public void onDestroy() {
        super.onDestroy();
    }
}
